{% extends 'base.html' %}
{% block content %}
<div class="container mt-4">
  <h2>讨论板</h2>
  <a class="btn btn-primary mb-3" href="{{ url_for('new_post') }}">发帖</a>
  {% if posts %}
    <ul class="list-group">
      {% for post in posts %}
        <li class="list-group-item d-flex justify-content-between align-items-center">
          <div>
            <a href="{{ url_for('post_detail', post_id=post.id) }}">{{ post.title }}</a>
            {% if not post.is_approved and current_user.is_authenticated and current_user.id == post.author_id %}
              <span class="badge bg-warning text-dark ms-2">仅自己可见</span>
            {% endif %}
          </div>
          <span class="text-muted">
            <a href="{{ url_for('creator_home', user_id=post.author.id) }}">{{ post.author.username or post.author.email }}</a>
            {{ post.created_at.strftime('%Y-%m-%d %H:%M') }}
          </span>
        </li>
      {% endfor %}
    </ul>
  {% else %}
    <p>暂无帖子。</p>
  {% endif %}
</div>
  <b href="download.html" class="btn btn-primary mt-3">进入下载链接（无法点击）</b>
{% endblock %}
